﻿using System.Collections.Generic;
using System.Linq;
using Socium.Domain.Collections;
using Socium.Domain.Persons;
using Socium.Domain.Tests;
using Socium.Domain.Tests.Testings;

namespace Socium.Testings {
	class MultipleQuestionTreeItem : QuestionTreeItemBase<MultipleVariantTreeItemBase> {
		public MultipleQuestionTreeItem(ClosedQuestion model) : base(model) {}

		protected override IEnumerable<MultipleVariantTreeItemBase> GetChilderen(ClosedQuestion model) {
			return model.Variants.Select(variant => new MultipleVariantTreeItem(variant));
		}

		public override void Save(Person person, Testing testing) {
			Childeren.Iterate(item => item.Save(person, testing));
		}

		public override void Load(Person person, Testing testing) {
			Childeren.Iterate(child => child.Load(person, testing));
		}
	}
}
